package com.cn.ant.modules.wechat.service.function.impl;

import com.cn.ant.common.utils.SpringContextHolder;
import com.cn.ant.modules.wechat.entity.WeixinAccount;
import com.cn.ant.modules.wechat.entity.message.resp.TextMessageResp;
import com.cn.ant.modules.wechat.service.WeixinAccountServiceImpl;
import com.cn.ant.modules.wechat.service.function.KeyServiceI;

import javax.servlet.http.HttpServletRequest;
import java.util.ResourceBundle;

/**
 * ClassName:UserLoginService
 * Function:微信用户联合登录
 * Date: 2015/9/26 9:52
 *
 * @author huanggenhua
 * @version 1.0
 * @since JDK 1.6
 */
public class UserLoginService implements KeyServiceI {
    /**
     * 获取接口关键字，例如："翻译"
     *
     * @return
     */
    @Override
    public String getKey() {
        return "userLogin";
    }

    /**
     * 针对关键字的功能处理方法
     *
     * @param content        请求文本
     * @param defaultMessage 默认回复此文本消息
     * @param request        请求
     * @return
     */
    @Override
    public String excute(String content, TextMessageResp defaultMessage, HttpServletRequest request) {
        WeixinAccountServiceImpl weixinAccountService = (WeixinAccountServiceImpl) SpringContextHolder.getApplicationContext().getBean("weixinAccountService");
        WeixinAccount account = weixinAccountService.findByToUsername(defaultMessage.getFromUserName());
        String accountid = account.getId();
        ResourceBundle bundler = ResourceBundle.getBundle("application");
        return null;
    }
}
